1. Field of the Invention
Apparatuses and methods consistent with the present invention relate to processing data of a non-volatile memory, and more particularly, to processing data of a non-volatile memory that is capable of applying a writing unit operation to a plurality of sectors.
2. Description of the Related Art
In general, in embedded systems, for example, home appliances, communication apparatuses, set-top boxes or the like, non-volatile memories are mainly used as storage media that store and process data.
A flash memory, which is mainly used among the non-volatile memories, is a non-volatile storage element that can electrically delete data and rewrite the data. As compared with a storage medium based on a magnetic disk memory, the flash memory has a fast access time like a hard disk while only consuming a small amount of power, and has a small size. As a result, the flash memory is suitable for a portable apparatus.
The flash memory has different characteristics from those of a magnetic storage medium, such as a hard disk. Specifically, in the flash memory, a read/write operation can be performed as a page unit, while a data update operation cannot be performed as a page unit. In order to perform the data update operation in the flash memory, an erasing operation needs to be performed in a unit of a block that is a group of a plurality of pages. Here, there is a problem in that a unit of the erasing operation is larger than a unit of the write operation.
In order to compensate for disadvantages of the flash memory in that the unit of the erasing operation is larger than the unit of the write operation and the number of times data is deleted is restricted and use a file system that is designed on the basis of a hard disk, an FTL (Flash Translation Layer) has developed. The FTL is a type of software layer and allows the flash memory to be used like the hard disk. In order to achieve the above-described function, the FTL internally uses a mapping method, and its function and costs are determined according to an algorithm used.
Examples of the mapping method that is used in the FTL include a variety of mapping methods, such as a block mapping method and a page mapping method. The page mapping method will be exemplified. In the page mapping method, locations of data that are physically stored with respect to all sectors or pages are maintained and managed through a separate mapping table. That is, when the data update operation is actually performed in the flash memory, new data is written in the available free space of the flash memory, and when a location of a corresponding sector is changed, a sector mapping table is changed. At this time, each sector is a logical operation unit and each page is a physical operation unit. In a small-block flash memory, a sector and a page are the same, while, in a large-block flash memory, a page includes a plurality of sectors.
FIG. 1 is a diagram illustrating a page mapping method according to the related art.
As shown in FIG. 1, in a non-volatile memory 20 that includes a sector mapping table 10 and a plurality of blocks 22, when a user writes data in sectors in the sector number order of “1, 2, 0, 0, 3, 3, 3, 3, 5, 6, and 4”, it can be understood that data has been updated in the sector 0 and the sector 3 in the non-volatile memory 20. At this time, in the FTL that uses the page mapping method, new data is written in a free page 21 and the sector mapping table 10 is also updated. That is, the sector mapping table 10 becomes a mapping table between logical sector numbers and page numbers in the non-volatile memory 20.
Meanwhile, when a file system or a database is updated, an update operation of a plurality of sectors is performed. For example, when the sectors 1, 2, and 3 need to be updated, the write operation may be completed only in the sectors 1 and 2 due to a problem in the system, and then the write operation may be interrupted. In this case, the sector 3 becomes unstable such that the update operation is not performed, and as the result, it is not possible to secure the integrity of the file system or the database.
For this reason, a method has been used in which a journal or a log is displayed with respect to the operation that is processed in the database or the file system. This method is to backup original data in case the operation is interrupted and not completed. However, in general, the backup method is much more expensive to implement than the operation which the user desires to process.
Japan Laid-open Publication No. 2004-242160 discloses a method and corresponding apparatus for writing data at a high speed in which a data deleting process and a write completion notification in a flash memory overlap and a series of processes including write, deletion, and a write completion notification are performed in a short time. However, Japan Laid-open Publication No. 2004-242160 does not disclose a method in which the integrity of a file system or a database can be secured during the operation for updating a plurality of sectors.